package cn.hxzy.service.impl;

import cn.hxzy.entity.accreditation.TsVehicleCertification;
import cn.hxzy.mapper.TsVehicleCertificationMapper;
import cn.hxzy.service.TsVehicleCertificationService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Kuizhi.Ma
 * @since 2023-06-25
 */
@Service
public class TsVehicleCertificationServiceImpl extends ServiceImpl<TsVehicleCertificationMapper, TsVehicleCertification> implements TsVehicleCertificationService {

    @Autowired
    private TsVehicleCertificationMapper tsVehicleCertificationMapper;

    @Override
//    添加车辆认证信息
    public TsVehicleCertification insertTsVehicleCertification(TsVehicleCertification tsVehicleCertification) {
        int insert = tsVehicleCertificationMapper.insert(tsVehicleCertification);
        return insert == 0 ? null : tsVehicleCertification;
    }

    @Override
//    查询车辆信息根据车牌号
    public TsVehicleCertification selectTsVehicleCertification(String licensePlateNumber) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq(" plate_number", licensePlateNumber);
        TsVehicleCertification tsVehicleCertification = tsVehicleCertificationMapper.selectOne(wrapper);
        if (tsVehicleCertification == null) {
            return null;
        }
        return tsVehicleCertification;
    }
}
